package com.bw.zg3park2212.adpter

import android.widget.TextView
import com.bw.base.entity.OrderEntityItem
import com.bw.zg3park2212.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class OrderAdpter:BaseQuickAdapter<OrderEntityItem,BaseViewHolder>(R.layout.item_order) {
    override fun convert(helper: BaseViewHolder, item: OrderEntityItem) {
        helper.setText(R.id.inspector,item.inspector)
            .setText(R.id.orderType,item.orderType)
            .setText(R.id.address,item.address)
            .setText(R.id.appointmentTime,item.appointmentTime)
        val type = helper.getView<TextView>(R.id.status)
        if(item.status=="新建"){
            type.setBackgroundResource(R.drawable.bg_kongxian)
            type.setTextColor(context.getColor(R.color.color_kongxian))
            type.setText("新建")
        }else if(item.status=="进行中"){
            type.setBackgroundResource(R.drawable.bg_zganyong)
            type.setTextColor(context.getColor(R.color.color_zhanyong))
            type.setText("进行中")
        }else if(item.status=="已完成"){
            type.setBackgroundResource(R.drawable.bg_weihu)
            type.setTextColor(context.getColor(R.color.color_weihu))
            type.setText("已完成")
        }else{
            type.setBackgroundResource(R.drawable.bg_hui)
            type.setTextColor(context.getColor(R.color.color_hui))
            type.setText("已转派")
        }
    }
}